
import ac = module("utils/commons/array-collection");
	
/**
	* The list of valid usage status.
	* 
	* @author Xavier Sosnovsky, Anthony Morel
	*/
export class UsageStatus {
		
	/*==============================Fields================================*/
		
	private static _instance:UsageStatus;
		
	private static _usageStatus:ac.ArrayCollection<string>;
		
	/*============================Constants===============================*/
		
	/**
	    * The usage is mandatory.
	    */
	public static MANDATORY:string = "Mandatory";
	    
	/**
	    * The usage is mandatory when certain conditions are satisfied.
	    */
	public static CONDITIONAL:string = "Conditional";
	    
	/*===========================Constructor==============================*/
		
	public constructor(enforcer:SingletonEnforcer) {
	}
	    
	/*==========================Public methods============================*/
	    
	/**
	    * Whether the supplied usageStatus is in the list of valid SDMX usage 
	    * status.
	    * 
	    * @return true if the supplied usageStatus is in the list of valid SDMX 
	    * usage status, false otherwise.
	    */ 
	public static contains(usageStatus:string):bool {
	    return this.createUsageStatusList().contains(usageStatus);
	}
	    
	/*=========================Private methods============================*/
	    
	private static createUsageStatusList():ac.ArrayCollection<string> {
	    if (null == this._instance) {
            this._instance = new UsageStatus(new SingletonEnforcer());
            this._usageStatus = new ac.ArrayCollection<string>();
            this._usageStatus.addItem(this.MANDATORY);
            this._usageStatus.addItem(this.CONDITIONAL);
		}
        return this._usageStatus;
	}
}

export class SingletonEnforcer {
}